package com.lele.org.swagger;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author zhangql 2018/08/04 swagger 配置类
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

//	@Value("${swagger.enable}")
//	private boolean enableSwagger;

	/*
	 * @Bean public Docket testApi() { // 请求时间 ParameterBuilder
	 * parameterBuilderRequestTime = new ParameterBuilder();
	 * parameterBuilderRequestTime.name(HeaderEnum.REQUESTTIME.getName())
	 * .description(HeaderEnum.REQUESTTIME.getDescription()) .modelRef(new
	 * ModelRef("long")) .parameterType(HeaderEnum.HEADER.getName())
	 * .required(false) .build();
	 * 
	 * //版本号 ParameterBuilder parameterBuilderVersion = new ParameterBuilder();
	 * parameterBuilderVersion.name(HeaderEnum.VERSION.getName())
	 * .description(HeaderEnum.VERSION.getDescription()) .modelRef(new
	 * ModelRef("string")) .parameterType(HeaderEnum.HEADER.getName())
	 * .required(false) .build();
	 * 
	 * //Token鉴权 ParameterBuilder parameterBuilderToken = new ParameterBuilder();
	 * parameterBuilderToken.name(HeaderEnum.TOKEN.getName())
	 * .description(HeaderEnum.TOKEN.getDescription()) .modelRef(new
	 * ModelRef("string")) .parameterType(HeaderEnum.HEADER.getName())
	 * .required(false) .build();
	 * 
	 * List<Parameter> parameters = new ArrayList<Parameter>();
	 * parameters.add(parameterBuilderRequestTime.build());
	 * parameters.add(parameterBuilderVersion.build());
	 * parameters.add(parameterBuilderToken.build());
	 * 
	 * return new Docket(DocumentationType.SWAGGER_2) .enable(enableSwagger)
	 * .apiInfo(apiInfo()) .globalOperationParameters(parameters) .select()
	 * .apis(RequestHandlerSelectors.basePackage("com.gsafety"))
	 * .paths(PathSelectors.any()) .build(); }
	 */
	
	private ApiInfo apiInfo(){
		ApiInfo apiInfo = new ApiInfo("zhangql spring cloud 1 documents",//
				"spring cloud 练习接口文档",
				"1.0",
				"这是啥",
				new Contact("zhangql", "", "qianleZhang@163.com"),//作者
				"链接显示文字",
				"http://www.baidu.com/"//w网站链接
				);
		return apiInfo;
	}

}
